package bairui.international.model.domain.jpa;

/**
 *
 * @see TB_ProductOrderItem 产品订单项
 *
 */
public class TestData_TB_ProductOrderItem
{

	private final static org.apache.commons.text.RandomStringGenerator Generator = new org.apache.commons.text.RandomStringGenerator.Builder().withinRange(new char[][]{{'a','z'}, {'A','Z'}, {'0','9'}}).build();

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_ProductOrderItem saveMust(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.id.ID_ProductOrderItem id
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_ProductOrderItem");
		return (TB_ProductOrderItem)repository.save(newMust(
				id
			));
	}
	
	public static TB_ProductOrderItem newMust(
		bairui.international.model.domain.jpa.id.ID_ProductOrderItem id
	){
		return new TB_ProductOrderItem(new TB_ProductOrderItem.MustProperties() {
			@Override public bairui.international.model.domain.jpa.id.ID_ProductOrderItem getId(){
				return id;
			}
			/** 数量 */
			@Override public Long getAmount(){
				return com.sh_lianjing.test.random.Util_GenerateRandom.longRandom(0, Long.MAX_VALUE);
			}
			/** 产品单价 */
			@Override public Double getProductPerPrice(){
				return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(Long.MIN_VALUE, Long.MAX_VALUE);
			}
			/** 产品总价 */
			@Override public Double getProductTotalPrice(){
				return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(Long.MIN_VALUE, Long.MAX_VALUE);
			}
			/** 类型 */
			@Override public bairui.international.model.type.Type_ProductOrderItem getType(){
				return bairui.international.model.type.Type_ProductOrderItem.Product;
			}
			/** 产品积分 */
			@Override public Double getProductScore(){
				return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(Long.MIN_VALUE, Long.MAX_VALUE);
			}
			/** 产品总积分 */
			@Override public Double getProductTotalScore(){
				return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(Long.MIN_VALUE, Long.MAX_VALUE);
			}
		});
	}
	

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_ProductOrderItem saveAll(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.id.ID_ProductOrderItem id,
	bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord branchCompanyStaffRoyaltyRecord
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_ProductOrderItem");
		return (TB_ProductOrderItem)repository.save(newAll(
				id,
				branchCompanyStaffRoyaltyRecord
			));
	}
	
	public static TB_ProductOrderItem newAll(
		bairui.international.model.domain.jpa.id.ID_ProductOrderItem id,
	bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord branchCompanyStaffRoyaltyRecord
	){
		return new TB_ProductOrderItem(
			new TB_ProductOrderItem.MustProperties() {
				@Override public bairui.international.model.domain.jpa.id.ID_ProductOrderItem getId(){
					return id;
				}
				/** 数量 */
				@Override public Long getAmount(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.longRandom(0, Long.MAX_VALUE);
				}
				/** 产品单价 */
				@Override public Double getProductPerPrice(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(Long.MIN_VALUE, Long.MAX_VALUE);
				}
				/** 产品总价 */
				@Override public Double getProductTotalPrice(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(Long.MIN_VALUE, Long.MAX_VALUE);
				}
				/** 类型 */
				@Override public bairui.international.model.type.Type_ProductOrderItem getType(){
					return bairui.international.model.type.Type_ProductOrderItem.Product;
				}
				/** 产品积分 */
				@Override public Double getProductScore(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(Long.MIN_VALUE, Long.MAX_VALUE);
				}
				/** 产品总积分 */
				@Override public Double getProductTotalScore(){
					return com.sh_lianjing.test.random.Util_GenerateRandom.doubleRandom(Long.MIN_VALUE, Long.MAX_VALUE);
				}
			},
			new TB_ProductOrderItem.OptionalSingleProperties() {
				/** 产品代码 */
				@Override public String getProductNumber(){
					return Generator.generate(0, 32);
				}
				/** 产品名称 */
				@Override public String getProductName(){
					return Generator.generate(0, 255);
				}
				/** 产品图片 */
				@Override public String getProductImgUrl(){
					return Generator.generate(0, 255);
				}
				/** 产品备注 */
				@Override public String getProductComment(){
					return Generator.generate(0, 32);
				}
				/** 产品单位 */
				@Override public String getProductUnit(){
					return Generator.generate(0, 255);
				}
				/** 分公司员工提成记录 */
				@Override public bairui.international.model.domain.jpa.TB_BranchCompanyStaffRoyaltyRecord getBranchCompanyStaffRoyaltyRecord(){
					return branchCompanyStaffRoyaltyRecord;
				}
			}
		);
	}
	

}
